import 'package:animal/constant/color.dart';
import 'package:animal/constant/font.dart';
import 'package:animal/ui/mine/controller/recharge_controller.dart';
import 'package:animal/utils/screen_util.dart';
import 'package:animal/widgets/appbar_widget.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';

///充值
class RechargePage extends StatelessWidget {
  const RechargePage({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    final controller = Get.put(RechargeController());
    List<String> data = [
      "10元",
      "50元",
      "100元",
      "200元",
      "300元",
      "500元",
    ];
    return Scaffold(
      backgroundColor: KColorConstant.appBgColor,
      appBar: AppBarWidget.defaultAppBar(title: Text("充值"), backgroundColor: Colors.white, elevation: 0),
      body: Column(
        children: [
          Container(
            color: Colors.white,
            padding: EdgeInsets.symmetric(horizontal: ScreenUtil().L(30), vertical: ScreenUtil().L(20)),
            margin: EdgeInsets.symmetric(vertical: ScreenUtil().L(20)),
            child: Row(
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              children: [
                Text(
                  "充值金额",
                  style: KFontConstant.myTextStyle(size: 18),
                ),
                Row(
                  children: [
                    Text(
                      "0.00",
                      style: KFontConstant.myTextStyle(size: 20, bold: true, color: KColorConstant.black999999),
                    ),
                    Text(
                      "   元",
                      style: KFontConstant.myTextStyle(size: 18),
                    ),
                  ],
                ),
              ],
            ),
          ),
          GridView.builder(
              padding: EdgeInsets.only(top: ScreenUtil().L(0), left: ScreenUtil().L(20), right: ScreenUtil().L(20)),
              itemCount: 6,
              gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
                crossAxisCount: 3,
                crossAxisSpacing: ScreenUtil().L(15),
                mainAxisSpacing: ScreenUtil().L(15),
                childAspectRatio: 1.7,
              ),
              shrinkWrap: true,
              itemBuilder: (context, index) {
                return Container(
                  alignment: Alignment.center,
                  decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(ScreenUtil().L(10))),
                  child: Text(data[index], style: KFontConstant.myTextStyle(size: 18)),
                );
              }),
          Container(
              margin: EdgeInsets.symmetric(vertical: ScreenUtil().L(20), horizontal: ScreenUtil().L(20)),
              width: double.infinity,
              child: Text(
                "支付方式",
                style: KFontConstant.myTextStyle(size: 17),
              )),
          Container(
            color: Colors.white,
            padding: EdgeInsets.symmetric(vertical: ScreenUtil().L(10), horizontal: ScreenUtil().L(15)),
            child: Row(
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              children: [
                Row(
                  children: [
                    const Icon(
                      Icons.credit_card,
                      color: Colors.red,
                    ),
                    Container(
                      width: ScreenUtil().L(10),
                    ),
                    Text("工商银行(1212)", style: KFontConstant.myTextStyle(size: 18)),
                  ],
                ),
                Image.asset(
                  "icons/icon_next.png",
                  width: ScreenUtil().L(25),
                  color: KColorConstant.black666666,
                )
              ],
            ),
          ),
          Container(
            height: ScreenUtil().L(60),
          ),
          CupertinoButton(
            child: Text(
              "立即充值",
              style: KFontConstant.myTextStyle(size: 15, color: Colors.white),
            ),
            onPressed: () => controller.openRecharge(),
            color: Colors.blue,
            padding: EdgeInsets.symmetric(horizontal: ScreenUtil().L(120)),
          )
        ],
      ),
    );
  }
}
